package com.yunpeng.aidevice.error;

import com.yunpeng.aidevice.common.constant.ConfigConstantValues;
import com.yunpeng.common.dto.Result;
import com.yunpeng.aidevice.common.enums.ResultCodeEnum;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * NotFoundPageController
 *
 * @author : Moore(hemw)
 * @date : 2020-03-17
 */
@RestController
public class NotFoundPageController implements ErrorController {

    private static final String ERROR_PATH = "/" + ConfigConstantValues.ERROR_PAGE_VIEW;

    @Override
    public String getErrorPath() {
        return ERROR_PATH;
    }

    @RequestMapping(value = ERROR_PATH)
    public Result<Object> error() {
        return Result.build(ResultCodeEnum.UNKNOWN_REQUEST.getValue(), ResultCodeEnum.UNKNOWN_REQUEST.getLabel(), null);
    }
}